package com.haoze.common.utils;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 树形数据信息。
 * @author zj
 * @time 2018-04-27。
 */
public class Trees<T> {
	/**
	 * 节点ID
	 */
	private String id;
	/**
	 * 显示节点文本
	 */
	private String text;
	/**
	 * 节点状态，open closed
	 */
	private Map<String, Object> state;
	/**
	 * 节点是否被选中 true false
	 */
	private boolean checked = false;
	/**
	 * 节点属性
	 */
	private Map<String, Object> attributes;

	/**
	 * 子节点
	 */
	private Map<String, List<Trees<T>>> children;

	/**
	 * 子节点
	 */
	private List<Trees<T>> options = new ArrayList();

	/**
	 * 父ID
	 */
	private String parentId;

	private String sortNo;

	private String type;

	private String unit;

	private String elementId;

	private String pyCode;

	private String catalogId;

	private Integer maxValue;

	private Integer minValue;
	/**
	 * 是否有父节点
	 */
	private boolean hasParent = false;
	/**
	 * 是否有子节点
	 */
	private boolean hasChildren = false;

	private String rootId;//根节点

	private String createNum;//可创建数量1：只能创建一份 2：能创建多份
	private String isWebView;//是否以网页方式打开1：是 0：否

	public String getIsWebView() {
		return isWebView;
	}

	public void setIsWebView(String isWebView) {
		this.isWebView = isWebView;
	}

	public String getCreateNum() {
		return createNum;
	}

	public void setCreateNum(String createNum) {
		this.createNum = createNum;
	}

	public String getRootId() {
		return rootId;
	}

	public void setRootId(String rootId) {
		this.rootId = rootId;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Map<String, Object> getState() {
		return state;
	}

	public void setState(Map<String, Object> state) {
		this.state = state;
	}

	public boolean isChecked() {
		return checked;
	}

	public void setChecked(boolean checked) {
		this.checked = checked;
	}

	public Map<String, Object> getAttributes() {
		return attributes;
	}

	public void setAttributes(Map<String, Object> attributes) {
		this.attributes = attributes;
	}

	public Map<String, List<Trees<T>>> getChildren() {
		return children;
	}

	public void setChildren(Map<String, List<Trees<T>>> children) {
		this.children = children;
	}

	public List<Trees<T>> getOptions() {
		return options;
	}

	public void setOptions(List<Trees<T>> options) {
		this.options = options;
	}

	public boolean isHasParent() {
		return hasParent;
	}

	public void setHasParent(boolean isParent) {
		this.hasParent = isParent;
	}

	public boolean isHasChildren() {
		return hasChildren;
	}

	public void setChildren(boolean isChildren) {
		this.hasChildren = isChildren;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getSortNo() {
		return sortNo;
	}

	public void setSortNo(String sortNo) {
		this.sortNo = sortNo;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getPyCode() {
		return pyCode;
	}

	public void setPyCode(String pyCode) {
		this.pyCode = pyCode;
	}

	public Integer getMaxValue() {
		return maxValue;
	}

	public String getElementId() {
		return elementId;
	}

	public void setElementId(String elementId) {
		this.elementId = elementId;
	}

	public void setMaxValue(Integer maxValue) {
		this.maxValue = maxValue;
	}

	public Integer getMinValue() {
		return minValue;
	}

	public void setMinValue(Integer minValue) {
		this.minValue = minValue;
	}

	public String getUnit() {
		return unit;
	}

	public void setUnit(String unit) {
		this.unit = unit;
	}

	public String getCatalogId() {
		return catalogId;
	}

	public void setCatalogId(String catalogId) {
		this.catalogId = catalogId;
	}

	public Trees(String id, String text, Map<String, Object> state, boolean checked, Map<String, Object> attributes,
				 Map<String, List<Trees<T>>> children, boolean isParent, boolean isChildren, String parentID) {
		super();
		this.id = id;
		this.text = text;
		this.state = state;
		this.checked = checked;
		this.attributes = attributes;
		this.children = children;
		this.hasParent = isParent;
		this.hasChildren = isChildren;
		this.parentId = parentID;
	}

	public Trees() {
		super();
	}

	@Override
	public String toString() {

		return JSON.toJSONString(this);
	}

}